import {Page} from '@/base/Page';
import {Lv} from '@/base/model/Lv';
import {isEmpty} from '@/base/util/Strings';
import {infoBloc} from "@/store/module/Info";
import {News} from "@/base/model/News";
import {Form} from "view-design";
import {getLvList} from "@/base/api/LvApi";

// class Form {
//   createBegin = '';
//   createEnd = '';
//   phone = '';
//   nickname = '';
//   date = [];
// }

export class LvBloc {
  // form = new Form();

  // paged: Page<Lv> = new Page<Lv>([], 0, 1, 15, 0, []);
  loading = false;
  paged: Page<Lv> = new Page<Lv>([], 0, 1, 15, 0, []);

  load(pageIndex: number, pageSize: number) {
    this.loading = true;
    return getLvList({
      pageIndex,
      pageSize,
      sortDirection: 'ASC'
    }).then((res) => {
      this.paged = res.data;
    }).finally(() => {
      this.loading = false;
    });
  }


  // getNickName(memberid: number) {
  //   const item = this.paged.items.find(x => x.memberid === memberid);
  //   return item == null ? '' : item.name;
  // }
  // getphone(memberid: number) {
  //   const item = this.paged.extras.find(x => x.id === memberid);
  //   return item == null ? '' : item.phone;
  // }
}
